package com.fen.demo001;

/**
 * @author : lrf
 * @description :
 * @tip :
 * @date : 2019/3/21
 */
public class StandardOutMessageRenderer implements MessageRenderer {

    private MessageProvider messageProvider;

    @Override
    public void reader() {
        if (messageProvider == null) {
            throw new RuntimeException(
                    "You must set the property messageProvider ofclass："
                            + StandardOutMessageRenderer.class.getName());
        }
        System.out.println(messageProvider.getMessage());
    }

    @Override
    public void setMessageProvider(MessageProvider provider) {
        this.messageProvider = provider;
    }

    @Override
    public MessageProvider getMessageProvier() {
        return this.messageProvider;
    }
}
